package me.sealer.ssm.token;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 功能描述： $ TokenManager
 *
 * @author sealer
 * @email 1178884049@qq.com
 * @date 2019年12月02日 12时35分37秒
 */
public interface TokenManager {
    /**
     * 生成Token
     *
     * @param httpServletRequest httpServletRequest
     * @return token 已存在session中
     */
    Token createToken(HttpServletRequest httpServletRequest);

    /**
     * 验证token
     *
     * @param httpSession session
     * @param tokenId     tokenId
     * @return 验证结果，详见 TokenConstant.java
     */
    int verifyToken(HttpSession httpSession, String tokenId);

    /**
     * 验证token
     *
     * @param httpServletRequest httpServletRequest
     * @return 验证结果，详见 TokenConstant.java
     */
    int verifyToken(HttpServletRequest httpServletRequest);
}
